﻿using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;

namespace SimpleNugetServer
{
    public class NugetService : IHostedService
    {
        private INugetPackageSource _PackageSource;

        public NugetService(INugetPackageSource packageSource)
        {
            _PackageSource = packageSource;
        }

        public Task StartAsync(CancellationToken cancellationToken)
        {
            _PackageSource.LoadPackages();
            return Task.CompletedTask;
        }

        public Task StopAsync(CancellationToken cancellationToken)
        {
            _PackageSource.Dispose();
            return Task.CompletedTask;
        }
    }
}
